myStr = input("请输入一行字符串：")
myLetters = 0
myNums = 0
mySpaces = 0
others = 0
i = 0
while i < len(myStr):
    myChar = myStr[i]
    i += 1
    if myChar.isalpha():
        myLetters += 1
    elif myChar.isdigit():
        myNums += 1
    elif myChar.isspace():
        mySpaces += 1
    else:
        others += 1
print(f"\n字母的个数为{myLetters}")
print(f"数字的个数为{myNums}")
print(f"空格的个数为{mySpaces}")
print(f"其他字符的个数为{others}")
